package solution.T0215_2_UIKit;

import java.util.HashMap;
import java.util.Map;

public class PropertyUtil {
    private static final Map<String, String> properties = new HashMap<>();

    static {
        // 模拟配置文件内容
        properties.put("osType", "WINDOWS");
        properties.put("factory.WINDOWS", "solution.T0215_2_UIKit.kit.WindowsFactory");
        properties.put("factory.MAC", "solution.T0215_2_UIKit.kit.MacFactory");
    }

    // 获取配置值
    public static String getProperty(String propertyName) {
        return properties.get(propertyName);
    }

    // 修改 osType，模拟动态配置变更
    public static void setOsType(String osType) {
        if (!properties.containsKey("factory." + osType)) {
            throw new IllegalArgumentException("不支持的操作系统类型: " + osType);
        }
        properties.put("osType", osType);
    }
}